home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / memmap.zip / FIG.4 < prev    next >
Text File  |  1989-05-17  |  5KB  |  87 lines

  1. Figure 4.  Sample Relationship Between Program and Environment Memory Control Blocks
  2.  
  3.  Segment
  4.  Address
  5.  
  6. +----------------+
  7. |         offset |
  8. |         0      | 2        4        6        8        A        C        D
  9. | 163F   +----+--|+----+---+----+---+--------+--------+--------+--------+--------+
  10. |        | Tag| Owner  | Size   |                                                | <- Memory Control
  11. |        | 4D |  164A  | 0004   |                                                |        Block
  12. | 1640   +====+========+========+================================================+
  13. |+------>|  e n v i r o n m e n t   v a r i a b l e   o n e    | 00 |  e n v i r | \
  14. ||1641   +--------+--------+--------+--------+---+----+--------+----+---+--------+ |
  15. ||       |  o n m e n t   v a r i a b l e   t w o| 00 |        e n v i r o n m e | | Environment
  16. ||       +--------+--------+--------+--------+---+----+--------+--------+--------+ |    Memory
  17. ||       |  n t   v a r i a b l e   t h r e e|00 | 00 | 0001   |  d r i v e : \  | |    Block
  18. ||       +--------+--------+--------+--------+--------+--------+--------+--------+ |
  19. ||       |  p a t h \ p r o g r a m . e x t  |00 |                               | /
  20. ||       +--------+--------+--------+--------+--------+--------+--------+--------+
  21. ||
  22. |+----------------------------------------------------------------------------------------------------+
  23. |                                                                                                     |
  24. |+---------------+                                                                                    |
  25. ||        0      | 2        4        6        8        A        C        D                            |
  26. ||1649   +----+--|+----+---+----+---+--------+--------+--------+--------+--------+                    |
  27. ||       | Tag| Owner  | Size   |            |  DOS 4.0:  Program Name           | <- Memory Control  |
  28. ||       | 4D | 164A   | 0100   |            |                                   |        Block       |
  29. ||164A   +=============+========+============+===================================+                    |
  30. |+------>|   20CD |                                                              | \                  |
  31. +------->|or 27CD |    other program segment prefix fields                       | |                  |
  32.   164B   +--------+--------+--------+--------+--------+--------+--------+--------+ |                  |
  33.          |                                                                       | | Program          |
  34.          +--------+--------+--------+--------+--------+--------+--------+--------+ |  Memory          |
  35.          |                                                     |Environ-|        | |  Block           |
  36.    .     |                                                     | ment   |        | |                  |
  37.    .     |                                                     | 1640  -------------------------------+
  38.    .     +--------+--------+--------+--------+--------+--------+--------+--------+ |
  39.          |                                                                       | |
  40.          +--------+--------+--------+--------+--------+--------+--------+--------+ .
  41.          |                                   .                                   | .
  42.                                              .                                     .
  43.                                              .                                     /
  44.  
  45.  
  46. Notes:  1.  Numeric values are all in hexadecimal.
  47.  
  48.         2.  All addresses and pointers are paragraph (segment) references.
  49.             E.g., the address of the 163F paragraph is 163F:0.
  50.  
  51.         3.  Size values are in paragraphs (16-bytes).
  52.  
  53.         4.  Hex word values are stored in memory with bytes swapped,
  54.             but are not shown that way above.
  55.  
  56.         5.  When the MCB owner is 0000, the block following is
  57.             unallocated.
  58.  
  59.         6.  An MCB represents a 'Program' when the next paragraph starts
  60.             with 20CD or 27CD.  If the Owner is not the paragraph
  61.             following the MCB, the Owner must be the DOS kernel.
  62.             When the Owner immediately follows the MCB, its name (without
  63.             the path) can be found in the MCB, but only in DOS 4.0.  In
  64.             DOS 3.X, the name can be found by looking at the environment
  65.             pointer and scanning past the environment variables (see 8
  66.             below).
  67.  
  68.         7.  An MCB represents an 'Environment' when the Owner's
  69.             Environment pointer points to the paragraph following
  70.             the MCB.  In the example above, the MCB at 163F points
  71.             to its owner at 164A.  The Environment pointer, which is
  72.             at an offset 2C in the owner block, points to the block
  73.             at 1640, which is the paragraph following the MCB at 163F.
  74.  
  75.         8.  The environment variables are in ASCIIZ form following the
  76.             environment MCB, that is, each text variable is terminated
  77.             with hex 00.  The last variable is followed by a second 00.
  78.             In DOS 3.0 and later, the next word is 0001 and it is
  79.             followed by the fully qualified program name.
  80.  
  81.         9.  Any block can be displayed using DEBUG.  To display the
  82.             environment MCB and memory block above, enter:
  83.  
  84.                  >debug
  85.                  -d 163f:0 4f
  86.                  -q
  87.